﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ListBreifCV.aspx.cs" Inherits="WEB.APP.Modules.List.ListBreifCV" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script language="javascript" type="text/javascript">
        var ApplyFind = function () {
            hfKeyword.setValue(txtKeyword.getValue());
            paddingBar.changePage(0);
        }
        var RendererElectiveLeft = function (value, idxclomn, record) {
            switch (value) {
                case 0:
                    return 'No';
                case 1:
                    return 'Yes, but no elective left';
                case 2:
                    return 'Yes and has an elective left';
                default:
                    return value;
            }
        }
        var RendererProjectType = function (value, idxclomn, record) {
            if (value === null || value === '')
                return value;
            var _temp = '';
            var _items = value.split(',');
            for (var i = 0; i < _items.length; i++) {
                if (_items[i] === null || _items[i] === '')
                    continue;

                switch (_items[i]) {
//                    case '1':
//                        _temp += 'Database Design and Development' + ', ';
//                        continue;
//                    case '2':
//                        _temp += 'Software Development' + ', ';
//                        continue;
//                    case '3':
//                        _temp += 'Mobile Application' + ', ';
//                        continue;
//                    case '4':
//                        _temp += 'Web Application' + ', ';
//                        continue;
//                    case '5':
//                        _temp += 'Systems Analysis and Design' + ', ';
//                        continue;
//                    case '6':
//                        _temp += 'Website Design and Development' + ', ';
//                        continue;
//                    case '7':
//                        _temp += 'Systems Administration' + ', ';
//                        continue;
//                    case '8':
//                        _temp += 'Operating System Development' + ', ';
//                        continue;
//                    case '9':
//                        _temp += 'Web Systems development' + ', ';
                    //                        continue; 
                    case '1':
                        _temp += 'DD&D' + ', ';
                        continue;
                    case '2':
                        _temp += 'SD' + ', ';
                        continue;
                    case '3':
                        _temp += 'MA' + ', ';
                        continue;
                    case '4':
                        _temp += 'WA' + ', ';
                        continue;
                    case '5':
                        _temp += 'SA&D' + ', ';
                        continue;
                    case '6':
                        _temp += 'WD&D' + ', ';
                        continue;
                    case '7':
                        _temp += 'SA' + ', ';
                        continue;
                    case '8':
                        _temp += 'OSD' + ', ';
                        continue;
                    case '9':
                        _temp += 'WSD' + ', ';
                        continue;
                    default:
                        _temp += _items[i] + ', ';
                        continue;
                }
            }
            return _temp.substring(0, _temp.length - 2);
        }
        var RendererInterested = function (value, idxclomn, record) {
            return value ? 'Yes' : 'No';
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <ext:Hidden runat="server" ID="hfIsEdit" />
    <ext:Hidden runat="server" ID="hfIsDelete" />
    <ext:Hidden runat="server" ID="hfKeyword" />
    <ext:Hidden runat="server" ID="hdScreenDetailID" />
    <ext:Store ID="storeMain" runat="server" OnRefreshData="storeMain_OnRefreshData"
        WarningOnDirty="false">
        <Proxy>
            <ext:PageProxy />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="StudentId">
                <Fields>
                    <ext:RecordField Name="StudentId" />
                    <ext:RecordField Name="ElectiveLeft" />
                    <ext:RecordField Name="ProjectType" />
                    <ext:RecordField Name="Expertise" />
                    <ext:RecordField Name="Interested" />
                    <ext:RecordField Name="OtherSkill" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <BaseParams>
            <ext:Parameter Name="start" Value="0" Mode="Raw" />
            <ext:Parameter Name="limit" Value="50" Mode="Raw" />
        </BaseParams>
    </ext:Store>
    <ext:Viewport ID="Viewport1" runat="server" Layout="border">
        <Items>
            <ext:GridPanel ID="grdMain" runat="server" StripeRows="true" TrackMouseOver="true"
                AutoExpandColumn="Expertise" Border="false" Region="Center" StoreID="storeMain">
                <TopBar>
                    <ext:Toolbar ID="tbMain" runat="server">
                        <Items>
                            <ext:ToolbarSpacer />
                            <ext:Button ID="btnAdd" runat="server" Text="Add" Icon="TableAdd">
                                <Listeners>
                                    <Click Fn="AddDocument" />
                                </Listeners>
                            </ext:Button>
                            <ext:ToolbarSeparator runat="server" ID="tbsAdd" />
                            <ext:Button ID="btnDelete" runat="server" Text="Delete" Icon="TableRowDelete">
                                <Listeners>
                                    <Click Handler="deleteRows(#{grdMain});" />
                                </Listeners>
                            </ext:Button>
                            <ext:ToolbarSpacer />
                            <ext:ToolbarFill />
                            <ext:TextField ID="txtKeyword" runat="server" EmptyText="Search">
                                <Listeners>
                                    <SpecialKey Handler="if(e.getKey() == Ext.EventObject.ENTER) { ApplyFind(); }" />
                                </Listeners>
                            </ext:TextField>
                            <ext:ToolbarSpacer />
                            <ext:Button ID="btnFind" runat="server" Text="Search" Icon="Find" FormBind="true">
                                <Listeners>
                                    <Click Fn="ApplyFind" />
                                </Listeners>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <ColumnModel ID="ColumnModel1" runat="server" DefaultSortable="false">
                    <Columns>
                        <ext:RowNumbererColumn />
                        <ext:Column ColumnID="StudentId" DataIndex="StudentId" Header="Student Id" Width="70"/>
                        <ext:Column ColumnID="ElectiveLeft" DataIndex="ElectiveLeft" Header="Elective Left" Width="150">
                            <Renderer Fn="RendererElectiveLeft" />
                        </ext:Column>
                        <ext:Column ColumnID="ProjectType" DataIndex="ProjectType" Header="Project Type">
                            <Renderer Fn="RendererProjectType" />
                        </ext:Column>
                        <ext:Column ColumnID="Expertise" DataIndex="Expertise" Header="Expertise"/>
                        <ext:Column ColumnID="Interested" DataIndex="Interested" Header="Interested" Align="Center" Width="60">
                            <Renderer Fn="RendererInterested" />
                        </ext:Column>
                        <ext:Column ColumnID="OtherSkill" DataIndex="OtherSkill" Header="Other Skill"/>
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true" />
                </SelectionModel>
                <KeyMap>
                    <ext:KeyBinding>
                        <Keys>
                            <ext:Key Code="DELETE" />
                        </Keys>
                        <Listeners>
                            <Event Handler="deleteRows(#{grdMain});" />
                        </Listeners>
                    </ext:KeyBinding>
                </KeyMap>
                <Listeners>
                    <RowDblClick Handler="this.getSelectionModel().selectRow(rowIndex); ViewDetail(#{grdMain});" />
                    <RowContextMenu Handler="e.preventDefault(); #{RowContextMenu}.dataRecord = this.store.getAt(rowIndex);#{RowContextMenu}.showAt(e.getXY());this.getSelectionModel().selectRow(rowIndex);" />
                </Listeners>
                <BottomBar>
                    <ext:PagingToolbar ID="paddingBar" StoreID="storeMain" runat="server" PageSize="50"
                        DisplayInfo="true" EmptyMsg="No data found" DisplayMsg="{0} - {1} in {2}" />
                </BottomBar>
            </ext:GridPanel>
        </Items>
    </ext:Viewport>
    <ext:Menu ID="RowContextMenu" runat="server">
        <Items>
            <ext:MenuItem ID="mnEdit" runat="server" Text="View" Icon="TableEdit">
                <Listeners>
                    <Click Handler="ViewDetail(#{grdMain});" />
                </Listeners>
            </ext:MenuItem>
            <ext:MenuItem ID="mnDelete" runat="server" Text="Delete" Icon="Delete">
                <Listeners>
                    <Click Handler="deleteRows(#{grdMain});" />
                </Listeners>
            </ext:MenuItem>
        </Items>
    </ext:Menu>
    </form>
</body>
</html>
